package com.example.itcacp.entity;


import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 点赞实体类
 * */
@Data
@TableName("pc_like")
public class Like {
    @TableId(type = IdType.AUTO)
    private Long likeId;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;
    private Long targetId;
    private ContentType targetType; // 目标内容类型
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)  // 自动填充创建时间
    private LocalDateTime created_at; // 收藏时间

    public enum ContentType {  // 目标内容类型枚举
        BOLG, QUESTION, ESSAY, PROJECT, COMMENT
    }

}
